package com.hm_.config;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
@Component
public class String2DateCoverter implements Converter<String, Date>{
	 @Resource
	    private DateFormat format;
	@Override
	public Date convert(String arg0) {
//		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		try {
            return format.parse(arg0);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

}